﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter7.Section6
{
    public class Example06
    {
        public Example06()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double[], double[]> ff
                = new V.Function.ToLastType<double[], double[]>(func);
            V.Surface s = new V.Surface(ff);
            s.Parameter1StartValue = 0.0;
            s.Parameter1EndValue = 5.0;
            s.Parameter2StartValue = 0.0;
            s.Parameter2EndValue = 2.0*Math.PI;

            V.Function.ToLastType<double[], double[]> g
                = new V.Function.ToLastType<double[], double[]>(gfunc);

            V.SurfaceIntegral obj
                = new V.SurfaceIntegral(g, s);
            obj.Compute();
            result += obj.Result.ToString() + "\r\n";

            double res = 300.0*Math.PI;
            result += res.ToString() + "\r\n";
        }
        private double[] func(double[] u)
        {
            double[] x = new double[3];
            x[0] = u[0] * Math.Cos(u[1]);
            x[1] = u[0] * Math.Sin(u[1]);
            x[2] = 12.0;
            return x;
        }

        private double[] gfunc(double[] x)
        {
            double[] r = new double[3];
            r[0] = x[0];
            r[1] = x[1];
            r[2] = x[2];
            return r;
        }
    }
}
/*
942.485578225028
942.477796076938
*/
